home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / asm_msc1.arc / SCRSUBI.ASM < prev    next >
Assembly Source File  |  1988-11-20  |  2KB  |  77 lines

  1. ; SCRSUBI - screen display subroutine for interpretive BASIC
  2. ; Copyright 1983 Data Base Decisions
  3. ; CALL SCRSUBI(LIN$,ROW%,COL%,COLR%)
  4. ; LIN$ is the line to be displayed - can be up to 255 characters
  5. ; ROW% is the row where LIN$ is to start (1-25)
  6. ; COL% is the column where LIN$ is to start (1-80)
  7. ; COLR% is the color attribute to be used (see appendix C of Tech Reference)
  8.  
  9. skip    equ 1            ; 1 for interpretive, 2 for compiled
  10.  
  11. cseg    segment para public 'code'
  12. public    scrsubi
  13. scrsubi proc far
  14.     assume cs:cseg,ds:nothing,ss:nothing,es:nothing
  15.     push bp
  16.     mov bp,sp
  17.     push es
  18.     mov si,[bp+10]        ; get row
  19.     mov ax,[si]
  20.     dec ax            ; down by 1
  21.     mov cx,160
  22.     mul cx            ; multiply by 160
  23.     mov si,[bp+8]        ; get column
  24.     mov bx,[si]        ; in bx
  25.     dec bx            ; down by 1
  26.     sal bx,1        ; multiply by 2
  27.     add ax,bx        ; got location
  28.     mov di,ax
  29.     mov ax,0        ; check monitor type
  30.     mov es,ax
  31.     mov ax,es:[410h]    ; get config byte
  32.     and al,30h        ; isolate monitor type
  33.     cmp al,30h        ; color?
  34.     jnz p010        ; yes
  35.     mov ax,0b000h        ; mono screen address
  36.     jmp p020
  37. p010:    mov ax,0b800h        ; color screen address
  38.  
  39. p020:    mov dx,es:[463h]    ; point to 6845 base port
  40.     add dx,6        ; point to status port
  41.  
  42.     mov es,ax        ; point to monitor
  43.     mov si,[bp+6]        ; get color attribute
  44.     mov bh,[si]        ; in bh
  45.     mov si,[bp+12]        ; point to lin$
  46.     mov cl,[si]        ; length in cl - up to 255
  47.     mov ch,0
  48.     jcxz p060        ; quit if string length is zero
  49.     add si,skip        ; addr of string
  50.     mov si,[si]
  51.     cld
  52.  
  53. p030:    mov bl,[si]        ; get next character
  54.  
  55. p040:    in al,dx        ; get crt status
  56.     test al,1        ; is it low?
  57.     jnz p040        ; no - wait
  58.     cli            ; no interrupts
  59.  
  60. p050:    in al,dx        ; get crt status
  61.     test al,1        ; is it high?
  62.     jz p050         ; no - wait
  63.  
  64.     mov ax,bx        ; move color & character
  65.     stosw            ; move color & character again
  66.     sti            ; interrupts back on
  67.     inc si            ; point to next character
  68.     loop p030        ; done?
  69.  
  70. p060:    pop es            ; restore es
  71.     pop bp            ; return to caller
  72.     ret 8
  73.  
  74. scrsubi endp
  75. cseg    ends
  76.     end
  77.